<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>title</title>
      <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
            <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
      <style>
      #header { background: #fff; height:50px;}
    .aui-bar-nav{background-color: #fff;position: relative;}
    .aui-btn.aui-pull-left{ background: #FFF}
    .aui-btn.aui-pull-left span{color: #333}
      .aui-bar-nav .aui-btn .aui-iconfont,.aui-bar-nav .aui-title{color: #333}
      input {-webkit-appearance: none;}
  body{background-color:rgba(0,0,0,0)}
    .logo {padding-top: 100px;margin-bottom: 29px;}
    .logo img{display: block;;width:65px;height: 65px;display:block;margin: 0 auto;}
    .login_main{width: 100%;box-sizing: border-box;padding: 0 15px;margin-bottom: 18px;}
    .login_main input{height: 60px;line-height: 45px;padding-top: 15px;display:block;box-sizing: border-box;font-size: 13px;color: #A9A9A9;padding-left:24px;;width: 100%;background-repeat: no-repeat;background-position:left 29px;border-bottom: 1px solid #dedede}
    .login_main #username{background-image: url(../../image/username.svg);background-size: 13px 16px;}
    .login_main #password{background-image: url(../../image/password.svg);background-size: 13px 16px;}
    .login_main input::-webkit-input-placeholder {color:#A9A9A9;font-size: 13px;}
    .login_main input::-moz-placeholder{color:#A9A9A9;font-size: 13px;}
    .login_main input:-moz-placeholder {color:#A9A9A9;font-size: 13px;}
    .login_main input:-ms-input-placeholder {color:#A9A9A9;font-size: 13px;}
    .login_main .submit{padding-top: 0;border: none;padding-left: 0;width: 100%;box-sizing: border-box;height: 38px;color: #fff;text-align: center;line-height: 38px;font-size: 13px;background-color: #fc8622;margin-top:38px;display: block;
    }
    .le{float: left;}
    .ri{float: right;}
    .clearfix{clear: both;}
      .login_bottom{width: 100%;box-sizing: border-box;padding: 0 15px;}
      .login_bottom span{font-size: 13px;color: #B7B7B7}
      </style>
  </head>
  <body>
    <header id="header">
      <a class="aui-btn aui-pull-left" tapmode onclick="api.closeWin()">
          <span class="aui-iconfont aui-icon-left" style="font-size:14px;"></span>
      </a>
    </header>
    <section>
      <div class="logo">
        <img src="../../image/logo.png" alt="">
      </div>
    <div class="login_main">
          <input id="username" class="input" type="number" placeholder="请输入手机号">
          <input id="password" class="input" type="password" placeholder="请输入密码">
        <input tapmode onclick="fnLogin()" class="submit" type="button" value="登录">
    </div>
        <div class="login_bottom">
          <span class="le" onclick="wangji()">忘记密码</span>
          <span class="ri" onclick="fnregister()">立即注册</span>
          <div class="clearfix"></div>
        </div>
    </section>
  </body>
  <script type="text/javascript" src="../../script/api.js"></script>
    <script type="text/javascript" src="../../script/public.js"></script>
  <script type="text/javascript">
  apiready = function() {
      $api.rmStorage('member');
    keyback();
   function keyback() {

api.sendEvent({
 name: 'hsy',
 extra: {
   id:0
 }
});
       }
    // var aliphone = api.require('aliphone');
    // aliphone.verify({
    //     phone: api.getPhoneNumber({ sync: true })
    // }, function (rs, err) {
    //   console.log(JSON.stringify(rs));
    //     console.log(JSON.stringify(rs));
    //      api.getPhoneNumber({ sync: true })
    // });
    // console.log( api.getPhoneNumber({ sync: true }));
  };

  function fnLogin() {


      api.showProgress({
          style: 'default',
          animationType: 'fade',
          title: '信息验证中',
          text: '请稍后...',
          modal: false
      });
      if(usernameValue!=""&&passwordValue!=""){
        var username = $api.byId('username');
        var password = $api.byId('password');
        var usernameValue = $api.val(username);
        var passwordValue =  $api.val(password);
          $api.rmStorage('member');

        api.ajax({
      		url: $api.getStorage("backapi")+'/admin.php?c=login&m=ajax',
      	    method: 'post',
            data:{
              values:{
                username:usernameValue,
                password:passwordValue,

              }
            },
      	},function(ret, err){
  console.log(JSON.stringify(ret));
          console.log(JSON.stringify(ret.code.uid));
      	    if (ret.code.uid) {
              api.hideProgress();

              //登录成功
              $api.setStorage('member', ret.code.uid);
            console.log(  $api.getStorage('member'))
              $api.setStorage('sys', ret.id);
              api.showProgress({
                  style: 'default',
                  animationType: 'fade',
                  title: '登录成功',
                  text: '请稍后...',
                  modal: false
              });
              api.sendEvent({
    name: 'shuaxin',


});
            var jsfun = 'dingshi();';
              api.execScript({
                frameName: 'index',
                script: jsfun
             });
            api.closeWin();




      	    }else {
              if(ret.code==""){
                fnLogin();
              }
            xuehua(ret.code,2000)

            }

            console.log(JSON.stringify(ret));
      	});
      }else{

        // api.toast({
        //     msg: '还没有输入',
        //     duration: 2000,
        //     location: 'bottom'
        // });
          api.hideProgress();
          xuehua("还没有输入",2000)
      }


  }


  function fnregister() {
    api.openWin({
        name: 'register_win',
          slidBackEnabled:true,
        url: 'register_win.html',
        pageParam: {
            name: 'text'
        }
    });


  }

  function wangji() {
    api.openWin({
        name: 'wangji_win',
          slidBackEnabled:true,
        url: 'wangji_win.html',
        pageParam: {
            name: 'text'
        }
    });


  }

  </script>
  </html>
